<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>知识荟</title>
    <link rel="stylesheet" href="../css/discuss-search.css"/>
    <script type="text/javascript" src="../js/space-discuss-left.js"></script>
</head>

<body>
<!--**************顶部导航****************-->
<%@include file="../jsp/common/nav.jsp"%>
<!--**************左侧导航****************-->
<%@include file="../jsp/common/sidebar-scroll.jsp"%>
<!--***************右侧资源搜索界面*******************-->
<c:set var="user" value="${sessionScope.user}"/>
<c:set var="space" value="${sessionScope.space}"/>
<div class="right">
    <!--标题导航-->
    <div class="discuss-nav">
        <span class="discuss-nav-title"><a href="/index/main?id=${user.id}">学习空间</a></span>
        >
        <span class="discuss-nav-title"><a href="/index/space-main?space_id=${space.id}&name=${space.name}">${space.name}</a></span>
        >
        <span>讨论区</span>
    </div>
    <!--搜索框-->
    <div class="search-board">
        <form action="/discuss/searchSubmit" method="post">
            <div class="discuss-name">
                <div class="name">按话题名</div>
                <input type="text" name="title" size="120" class="input" value="${discuss.title}" placeholder="请输入话题名关键字"/>
            </div>
            <div class="discuss-name">
                <div class="name">按作者</div>
                <input type="text" name="authorName" size="120" class="input" value="${authorName}" placeholder="请输入话题作者"/>
            </div>
            <div class="discuss-name">
                <div class="name">按标签</div>
                <input type="text" name="name" size="20" class="input" value="${discuss.label}" placeholder="请输入话题标签"/>
            </div>
            <div class="discuss-name">
                <input type="submit" class="submit" value="搜索"/>
            </div>
        </form>
    </div>
    <div class="discuss-content">
        <div class="content-top">
            <div class="content1">
                <span class="content-name">话题名</span>
                <span class="writer">作者</span>
            </div>
            <div class="content2">
                <span class="detail">归属空间</span>
                <span class="date">创建时间</span>
            </div>
        </div>
        <!--搜索结果-->
        <c:forEach items="${discussesList}" var="discuss">
            <div class="discuss-list">
                <ul>
                    <li>
                        <div class="list">
                            <div class="content1">
                                <span class="list-name">
                                    <a href="/discuss/discuss-detail?id=${discuss.id}">
                                        <c:if test="${discuss.status==2||discuss.status==4}">
                                            <font color="red" style="font-weight: bold">${discuss.title}</font>
                                        </c:if>
                                        <c:if test="${discuss.status==1||discuss.status==3}">
                                            ${discuss.title}
                                        </c:if>
                                    </a>
                                </span>
                                <span class="writer">${discuss.user.username}</span>
                            </div>
                            <div class="content2">
                                <span class="detail">${discuss.space.name}</span>
                                <span class="date">
                                    <fmt:formatDate pattern="yyyy-MM-dd" value="${discuss.createdate}" />
                                </span>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </c:forEach>
    </div>
    <!--当查询结果没有时，给用户提示信息： -->
    <div class="discuss-list">
        <center><font color="gray" size="2">${requestScope.msg}</font></center>
    </div>
</div>
</body>
</html>

